<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<?php
	if (!isset($_SESSION)) {session_start();}
	require("php/akses.php");
	require("php/managesession.php");
	require("php/render.php");
	connect();
	
	$search = (isset($_GET['search']) ? $_GET['search'] : "");
	$number = (isset($_GET['number']) ? $_GET['number'] : 10);
	$page = (isset($_GET['page']) ? $_GET['page'] : 0);
	$sort = (isset($_GET['sort']) ? $_GET['sort'] : "time");
	$desc = (isset($_GET['desc']) ? $_GET['desc'] : true);
	$select_filter = (isset($_GET['select_filter']) ? $_GET['select_filter'] : "");
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<link rel="stylesheet" type="text/css" href="css/style.css" />
	<script type="text/javascript" src="javascript/foodholic.js"></script>
	<script type="text/javascript" src="javascript/like.js"></script>
	<title>Search <?php echo $select_filter . " " . $search; ?></title>
</head>

<body>
	<?php
		require "header.php";
		$contents = searchContent($search, $number, $page, $sort, $desc);
	?>
	
	<div id="content">
	<?php
		if (sizeof($contents) == 0) {
			echo "Konten tidak ditemukan";
		} else {
			echo "<div id='left_nav'>";
			$i = 1;
			foreach ($contents as $content) {
				echo "<div class='LikeContent'>
			<a onmouseover='' style='cursor: pointer;' onclick=\"return likeThis('like$i');\" id='staty'>
				<img src='images/like.png' alt='post' name='gambarLike' />
			</a>
			<a onmouseover='' style='cursor: pointer;' onclick=\"return dislikeThis('like$i');\">
				<img src='images/dislike.png' alt='post' />
			</a>
			<div class='likeCount'><a id='like$i'>${content['likes']}</a></div >
			<div><a id='statlike$i'></a></div>
		</div>";
				$i++;
			}
			echo "</div>";
			
			echo "<div id='contents'>";
			foreach ($contents as $content) {
				echo render($content);
			}
			echo "</div>
				<div class='clear'></div>";
		}
	?>
	</div>
	
	
	
	<?php require "footer.php"; ?>
</body>
</html>